# !usr/bin/env python
# -*- coding:utf-8 _*-
"""
@Author:张广勤
@Web site: https://www.tunan.wang
@Github:www.github.com
 
@File:Yi1_0.py
@Time:2024/8/7 15:53

@Motto:不积跬步无以至千里，不积小流无以成江海！
"""

import random

# 初始化记录每次投掷结果的列表
results = []

# 投掷六次
for _ in range(6):
    # 初始化单次投掷的结果列表
    single_throw = []
    # 投三枚铜钱
    for _ in range(3):
        # 随机生成'H'或'T'
        coin = 'H' if random.random() < 0.5 else 'T'
        single_throw.append(coin)
    # 将单次投掷的结果添加到总结果列表中
    results.append(single_throw)

# 打印每次投掷的结果
for i, throw in enumerate(results, 1):
    print(f"投掷{i}: {' '.join(throw)}")

# 如果需要，可以计算并打印总的正面和背面次数
total_heads = 0
total_tails = 0
for throw in results:
    total_heads += throw.count('H')
    total_tails += throw.count('T')

print(f"总共正面次数: {total_heads}")
print(f"总共背面次数: {total_tails}")
